<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>水仙花数</title>
</head>
<body>
    <script>
        for (var n = 1000 ; n < 10000 ; n++) {
            var ge = n % 10, 
            shi = parseInt(n / 10) % 10,bai = parseInt(n / 100) % 10,
            qian = parseInt(n / 1000),
            sum = Math.pow(ge, 4) + Math.pow(shi, 4) + Math.pow(bai, 4) + Math.pow(qian, 4);
            if (sum === n) {
                console.log(n)
            }
        } 
    </script>
</body>
</html>